<?php $this->load->view('layout/header');?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">用户管理<small> 添加帐号关联</small></h3>
            <?php echo breadcrumb(array('用户管理', '用户帐号管理', '帐号关联', '添加帐号关联')); ?>
        </div>
    </div>
    <?php echo execute_alert_message() ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-plus-sign"></i>添加帐号关联</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal user-related-form" action="<?php echo base_url('userrelatedself/editPost') ?>" method="post" enctype="multipart/form-data">
                        <div class="control-group add-supplieruid-html">
                            <label class="control-label"><em>* </em>供应商UID</label>
                            <div class="controls">
                                <input type="hidden" name="id" value="<?php echo $userrelatedself->id ?>">
                                <input type="text" name="provider_uid" value="<?php echo $userrelatedself->provider_uid ?>" class="m-wrap large supplieruid required tooltips number" data-original-title="双击可弹框选择供应商；直接输入‘用户名称或编号’可提示" data-trigger="hover">
                            </div>
                        </div>
                        <div class="control-group add-supplieruid-html">
                            <label class="control-label">分销商UID</label>
                            <div class="controls">
                               <input type="text" name="reseller_uid" value="<?php echo $userrelatedself->reseller_uid ?>" class="m-wrap large supplieruid required tooltips number" data-original-title="双击可弹框选择供应商；直接输入‘用户名称或编号’可提示" data-trigger="hover">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">总利润手续费（%）</label>
                            <div class="controls">
                                <input type="text" name="poundage" value="<?php echo $userrelatedself->poundage ?>" class="m-wrap large number" placeholder="请填写0到100的数字">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">状态</label>
                            <div class="controls">
                                <select name="flag" class="m-wrap medium">
                                    <?php foreach (array(1=>'正常', 2=>'冻结') as $kk=>$vv) :?>
                                    <option value="<?php echo $kk;?>" <?php if ($kk == $this->input->get('flag')):?> selected="selected"<?php endif;?>><?php echo $vv;?></option>
                                    <?php endforeach;?>
                                </select>
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit"><i class="icon-ok"></i> 保存</button>
                            <a href="<?php echo base_url('userrelatedself/grid') ?>">
                                <button class="btn" type="button">返回</button>
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
jQuery(function(){
	$('form.user-related-form').validate({
		 rules:{
			 provider_uid : {
                 remote:{
                    url  : hostUrl()+'/userrelatedself/checkProviderRepeat',
                    type : 'get',
                    dataType : 'json',
                    data : {
                    	     'provider_uid' : function(){return $('input[name="provider_uid"]').val();},
                    	     'id'           : function(){return $('input[name="id"]').val()}
                           } 
                 }
             }
         },
         messages:{
        	 provider_uid :{ remote:'该供应商已经绑定分销商'}
         },
    });
})
</script>
<?php $this->load->view('layout/footer');?>
<?php $this->load->view('user/addSupplierUid/ajaxGetUser');?>